<?php
namespace Index\Controller;
use Think\Controller;
use Org\Util\Wechat;

class KefuController extends Controller{
	
	private $WX = null;
	
	public function _initialize(){  
		$this->WX = new Wechat(C('wechat'));
	}
	
	function index(){
		$this->display();
	}
	
	function inlist(){
		$this->display();
	}
	
	function talk(){
		$this->display();
	}
	
	function getkf_list(){
		$rs = $this->WX->getCustomServiceKFlist();
		$this->_ajax(true,'OK',$rs);
	}
	
	function _ajax($s,$m,$d){
		$this->ajaxReturn(array('s'=>$s,'m'=>$m,'d'=>$d));
	}
	
	function addkf(){
		$rs = $this->WX->addKFAccount('nicky@test','Nicky','123456');
		$this->_ajax(true,'OK',$rs); 
	}
	
	function getInList(){
		$rs = $this->WX->getKFSessionlist('nicky@test');
		$this->_ajax(true,'OK',$rs); 
	}
}